package com.mask.sca.core.tenant;

public class TenantContext {
    private static final ThreadLocal<String> TENANT_HOLDER = new ThreadLocal<>();
    private static boolean enabled = true;

    public static void setTenantId(String tenantId) {
        if (enabled) {
            TENANT_HOLDER.set(tenantId);
        }
    }

    public static String getTenantId() {
        return enabled ? TENANT_HOLDER.get() : null;
    }

    public static void clear() {
        TENANT_HOLDER.remove();
    }

    public static void setEnabled(boolean flag) {
        enabled = flag;
    }

    public static boolean isEnabled() {
        return enabled;
    }
} 